Returns the last element of an enumeration.
Use the method to obtain the last element of an enumeration. The method throws an exception if the enumeration contains no elements. To instead return nil when the enumeration is empty, use the LastOrDefault method.